package com.example.controller;
import com.example.dto.ExcelExportResponse;
import com.example.dto.UserExportRequest;
import com.example.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
/*
@description:
@ClassName UserController
@author chen
@create 2025-06-25 16:22
@Version 1.0
*/
@Controller
@CrossOrigin(origins = "*")
public class UserController
{

    @Resource
    private UserService userService;

    @GetMapping("/userList")
    public String userList(Model model)
    {
        model.addAttribute("userList", this.userService.getUserList());
        return "userList";
    }


    @PostMapping("/userExport")
    @ResponseBody
    public ExcelExportResponse userExport(@RequestBody UserExportRequest userExportRequest) throws IOException
    {
        return this.userService.userExport(userExportRequest);
    }


}
